'use strict'

let models = require('../models');
let config = require('../../config');
let errors = config.errors;
let Session = require('../middlewares/session');

let checkTimeSetService = require('../services/checktimeset');

let actionUpdateCheckTimeSet = {
    privileges: [ 'leader' ],
    handler(req, res) {
        let checkTimeSetId = req.params.checkTimeSetId;
        let checkTimeSetData = req.body.checkTimeSet;
        let checkTimeSet = checkTimeSetService.updateCheckTimeSet(checkTimeSetId, checkTimeSetData);

        res.json({
            successful: true,
            data: {
                checkTimeSet: checkTimeSet.toObject({
                    recursive: true
                })
            }
        });
    }
};

module.exports = {
    actionUpdateCheckTimeSet
};
